Release 10.1A: OpenEdge Development:
Progress 4GL Handbook


Passing temp-tables by reference or by binding

What should you do when the call is always or sometimes local? In these situations, you can optimize your code by passing the TABLE-HANDLE parameter by reference or binding (starting with OpenEdge Release 10.1A). Both of these options are described in the "Using a temp-table as a parameter" section.

Note: When you pass temp-tables by reference or by binding, all of the possible inter-operability between static and dynamic temp-tables applies, as described in
Table 20–2.

TABLE-HANDLE form with BY-REFERENCE

To pass a TABLE-HANDLE by reference, use this syntax for the RUN statement in the calling routine:

( { [INPUT] | OUTPUT | INPUT-OUTPUT } TABLE-HANDLE tt-handle 
    BY-REFERENCE). 

If the called routine’s temp-table is a static temp-table, you can save the overhead of instantiating it by defining it as REFERENCE-ONLY:

DEFINE TEMP-TABLE temp-table-name REFERENCE-ONLY. 

TABLE-HANDLE form with BIND

To pass a TABLE-HANDLE by binding, you must specify the BIND keyword in both the calling and the called routines to tell Progress to use the same temp-table instance for both routines. If the temp-table that will be used as a pointer is static, use the REFERENCE-ONLY keyword when you define the temp-table. Alternately, if the temp-table that will be used as a pointer is dynamic, set the TABLE-HANDLE parameter to UNKNOWN.

For example, use this syntax in the calling routine:

( { [INPUT] | OUTPUT | INPUT-OUTPUT } TABLE-HANDLE tt-handle BIND. 

In the called routine, use this syntax:

DEFINE [INPUT | OUTPUT | INPUT-OUTPUT ] 
    PARAMETER TABLE-HANDLE tt-handle BIND. 

In whichever routine that contains the temp-table that is not being used, you should define that temp-table as REFERENCE-ONLY if it is static:

DEFINE TEMP-TABLE temp-table-name REFERENCE-ONLY ... 

For example, if you are using the called routine’s temp-table data, you define the calling routine’s static temp-table as REFERENCE-ONLY. If you are using the calling routine’s temp-table data, you define the called routine’s static temp-table as REFERENCE-ONLY.

Alternately, if the unused temp-table is dynamic, you should set the TABLE-HANDLE parameter to UNKNOWN.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095